﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MillerApp.CommonLib.OfficeProvider;
using MillerApp.Business.Stock;

namespace MillerApp.Tools
{
    /// <summary>
    /// 根据Excel内容生成文件
    /// </summary>
    public partial class ExcelCodeGenerator : Form
    {
        public ExcelCodeGenerator()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 浏览Excel文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBrowser_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fileName = openFileDialog1.FileNames[0];
                if (!System.IO.File.Exists(fileName))
                {
                    return;
                }
                txtSourceFilePath.Text = fileName;
            }
        }

        /// <summary>
        /// 根据Excel文件生成文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreate_Click(object sender, EventArgs e)
        {
            SecurityService s = new SecurityService();
            s.AutoGetInOrOutflows(new DateTime(2013, 2, 5));
            //if (string.IsNullOrEmpty(txtSourceFilePath.Text))
            //{
            //    return;
            //}
            //if (System.IO.File.Exists(txtSourceFilePath.Text) == false)
            //{
            //    return;
            //}
            //string filePath=txtSourceFilePath.Text;
            //ExcelProvider excel = new ExcelProvider();
            //DataSet ds = excel.GetDataFormExcel(filePath,"Sheet1$");
            //DataTable dt = ds.Tables[0];
        }


    }
}
